package com.lx.tldoj.model.vo;

import cn.hutool.json.JSONUtil;
import com.lx.tldoj.model.entity.Competition;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 题目封装类
 * @TableName competition
 */
@Data
public class CompetitionVO implements Serializable {
    private Long contestId;
    private String title;
    private String description;
    private Date startTime;
    private Date endTime;
    private Integer isPublic;
    private Long creatorId;
    private Date createdAt;
    private Date updatedAt;

    /**
     * 包装类转对象
     *
     * @param competitionVO
     * @return
     */
    public static Competition voToObj(CompetitionVO competitionVO) {
        if (competitionVO == null) {
            return null;
        }
        Competition competition = new Competition();
        BeanUtils.copyProperties(competitionVO, competition);


        return competition;
    }

    /**
     * 对象转包装类
     *
     * @param competition
     * @return
     */
    public static CompetitionVO objToVo(Competition competition) {
        if (competition == null) {
            return null;
        }
        CompetitionVO competitionVO = new CompetitionVO();
        BeanUtils.copyProperties(competition, competitionVO);


        return competitionVO;
    }

    private static final long serialVersionUID = 1L;
}